<template>
  <div class="block">
    <el-pagination
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
      :current-page="paging.currentPage"
      :page-sizes="[5, 10, 20, 30, 40]"
      :page-size="paging.pagesize"
      layout="total, sizes, prev, pager, next, jumper"
      :total="paging.total"
    >
    </el-pagination>
  </div>
</template>

<script>
export default {
  props: {
    paging: {
      type: Object,
      required: true,
    },
    onSubmit: {
      type: Function,
      required: true,
    },
  },
  methods: {
    handleSizeChange(val) {
      //每页  条
      this.paging.pagesize = val;
      this.onSubmit();
    },
    handleCurrentChange(val) {
      //当前页
      this.paging.currentPage = val;
      this.onSubmit();
    },
  },
};
</script>
